Linking multi-level population dynamics: state, role, and population

The dynamics of an ecological community can be described at different focal scales of the species, such as individual states or the population level. More detailed descriptions of ecological dynamics offer more information, but produce more complex models that are difficult to analyze. Adequately controlling the model complexity and the availability of multiple descriptions of the concerned dynamics maximizes our understanding of ecological dynamics. One of the central goals of ecological studies is to develop links between multiple descriptions of an ecological community. In this article, starting from a nonlinear state-level description of an ecological community (generalized McKendrick–von Foerster model), role-level and population-level descriptions (Lotka–Volterra model) are derived in a consistent manner. The role-level description covers a wider range of situations than the population-level description. However, using the established connections, it is demonstrated that the population-level description can be used to predict the equilibrium status of the role-level description. This approach connects state-, role-, and population-level dynamics consistently, and offers a justification for the multiple choices of model description.


INTRODUCTION
The dynamics of an ecological community can be described at different focal scales of the species, such as individual states or the population level (Banasiak & Lachowicz, 2014;Lachowicz, 2011;Law, Murrell & Dieckmann, 2003). More detailed descriptions of ecological dynamics offer a greater amount of information, but provide more complex models that are difficult to analyze. Adequately controlling the model complexity according to the question at hand maximizes our understanding of the dynamics of an ecological community. Establishing links between multiple descriptions of an ecological community is one of the central goals of ecological studies (Lachowicz, 2011;Nakazawa, 2015;Ovaskainen et al., 2014;Poisot, Stouffer & Gravel, 2015) because consistent connections offer a flexible choice of model and justify the ecological implications of the focal level deduced from the description of another level.
In the dynamics of an ecological community, species interactions characterize the level of description. For example, a population-level description is characterized by homogeneous interactions between two species, and each species is characterized as prey, predator, or competitor (Allesina & Tang, 2012;Mougi, 2012). At this level of discussion, the types of interactions can be classified according to the interaction compass, where the signs of the interaction coefficients reflect each possible type of interaction (e.g., (−, +) and (+, −) for predation and (−, −) for competition) (Haskell, 1949;Nathaniel Holland & DeAngelis, 2009). This offers a concise description of ecological dynamics via the Lotka-Volterra model (Murray, 2004), and has been a major driver of studies on ecological dynamics and stability (e.g., May, 1972;Mougi, 2012;Serván et al., 2018). Alternatively, in a state-level description, each individual is grouped into sets of states (e.g., age or weight), and the interaction compass is no longer useful; instead, infinitely many interaction strengths are required. The state-level description offers a detailed and more realistic description of a population because variations in ecological state are ubiquitous within a population (Bolnick et al., 2011;Poisot, Stouffer & Gravel, 2015); however, this description has a rather complex form.
This motivates an intermediate level of description for an ecological community at an ecologically relevant scale. A wide range of species exhibit an ontogenetic diet/trophic niche shift (Winemiller, 1989;Yang & Rudolf, 2010) with or without a drastic habitat shift (Takimoto, 2003). The ontogenetic shift may largely alter the interspecific interaction strength among individuals within a population, and these shifts can lead to multiple roles at different life stages of the individuals (Nathaniel Holland & DeAngelis, 2009;Yang & Rudolf, 2010). For example, in a fish community, larger individuals of the fish species prey on smaller individuals available in a particular space (Hartvig & Andersen, 2013), where individuals of the species have prey and predator roles at different life stages. The combination of role shifts can be any set of, for instance, prey, predator, or superior/ inferior competitor. This role-level view may provide an intermediate description of an ecological community.
Size-or age-structured models (Hartvig, Andersen & Beyer, 2011;Hastings, 1987;Takashina & Fiksen, 2020) and physiologically structured population models (De Roos et al., 2008;Metz & Diekmann, 1986) are commonly used to integrate states into population dynamics. Although this offers more detailed descriptions of the population dynamics than a population-level description, it usually demands more assumptions and parameters. For instance, Hartvig, Andersen & Beyer (2011) developed a size-structured community model focusing on fish communities and highly mechanistic bases. In this framework, the size-dependent predation defined by a predator-prey mass ratio (Brose, 2010) determines the variable interaction strength. Although the model is described by mechanistic bases and is useful for discussing the coexistence of multiple species (Hartvig & Andersen, 2013;Zhang et al., 2013), the model complexity obscures a clear connection to existing population-level discussions. De Roos (1997) scaled up the physiologically structured juvenile and adult states to population-level dynamics. Their model can be complemented with non-structured resource dynamics, leading to the development of an extended model of the consumer-resource dynamics (i.e., (−, +) and (+, −) interaction types in the interaction compass) by Yodzis & Innes (1992). Alternative approaches starting from stochastic individual-level dynamics that scale to deterministic population-level dynamics have also been widely discussed (e.g., Banasiak & Lachowicz, 2014;McKane & Newman, 2004;Ovaskainen et al., 2014).
Given the important role of the Lotka-Volterra model in ecological studies that can capture various types of species interactions, as well as the importance of the ecological state in population dynamics, it is fundamental to ask how and when the state-level description of an ecological community are related to the Lotka-Volterra model. These insights provide a justification and highlight the limitations of the use of the Lotka-Volterra model, and give another potential description of the ecological community at different scales. In this article, I first introduce an N-species generalization of the nonlinear size-structured model (i.e., in the form of the McKendrick-von Foerster equation (Murray, 2004)), as discussed in Hastings (1987) and Nisbet & Gurney (1982), as a state-level description of an ecological community. By aggregating the states into new groups, I identify the connections between state-, role-, and population-level dynamics, where the population-level dynamics correspond to the Lotka-Volterra equation where role-level information can be carried over. The role-level model derived in the process of scaling-up the description of the ecological community is a new class of model that can describe a wider range of ecological communities than the population-level description can handle. The existing literature often discusses "stages," such as juvenile or adult (e.g., De Roos, 1997;Hastings & Costantino, 1987;Hastings, 1987;Hin et al., 2011), rather than "roles" as an intermediate-level description. However, the role is considered in this article, as it captures a wider situation than the stage. For instance, there can be multiple roles within a single stage.
The goal of this study is to identify the links between multiple descriptions of ecological community dynamics, rather than to provide detailed investigations of each description. However, the role-level description has not been widely investigated in ecological studies, so I clarify some of the equilibrium properties of the role-level model in a simple situation. I demonstrate this by using the established connection: a simpler population-level description can predict the equilibrium states of a more complex role-level description. In the example, I consider three possible scenarios of role shifts as the result of an ontogenetic diet/trophic niche shift: (i) from inferior/superior competitor to superior/ inferior competitor; (ii) from competitor to predator; and (iii) from prey to predator. The standard isocline method of population-level dynamics is used to discuss the equilibrium properties of the role-level dynamics caused by the links between different levels of the population dynamics. This is a convenient approach to analyze a more complex model using the knowledge of a simpler model while it may be only applicable to equilibrium properties and systems that converge to a single stable state.
The approach described in this article offers an opportunity to discuss population dynamics at multiple levels where the population-level dynamics correspond to the Lotka-Volterra model. The model complexity can be controlled, and further elaborations are straightforward. This also provides flexibility in the use of empirical data.

MULTI-LEVEL POPULATION DYNAMICS General concept of multiple descriptions of ecological community
This section describes how the Lotka-Volterra model is derived as a population-level description from more detailed descriptions (state and role; Fig. 1A). I start with a state-level discussion of the situation presented in Fig. 1B, where the largest information can be incorporated. Then, we derive the role-level and population-level dynamics by scaling-up the focal level of the population dynamics, where we assume a simple situation where two species and two roles are considered. This approach is justified because the state-based dynamics contain information on the role-(if any) and population-level dynamics, but the opposite is not true. That is, scaling-up provides a simpler model but loses some information.
Notably, one can control the specificity (i.e., information) of the model by choosing what to scale up. Here, I demonstrate the role-level information is carried over to the Lotka-Volterra (population-level) model that contains larger information than the ordinary one where the interaction coefficients between species are fixed constant. The Lotka-Volterra model derived here provides an insight into the connection with nature where diverse interspecific interaction patterns are observed between species. The ordinary Lotka-Volterra model is readily recovered from the model by losing the information of role-shift (i.e., giving a fixed interaction strength). The role-level model contains the information of the Lotka-Volterra model, so the knowledge of the Lotka-Volterra model is applicable to the role-level model to some extent. By so doing, the connection to a different level of description becomes clear. I will demonstrate this in the following section.

State-level dynamics
I begin with a state-level model that describes the N-species dynamics in which each individual of a species changes its state (e.g., age or weight) throughout its lifetime. The starting point is the common McKendrick-von Foerster equation (Murray, 2004). I extend this model by introducing the effects of intra-and inter-specific competition among the N species. The population dynamics of species i in state s, n i (s,t), can be described as where g(s) is the rate of growth in state s on the state axis and d i is the death rate of species i. a i(s)j(s′) is the (nonnegative) interaction strength between state s of species i and state s′ of species j. The second term on the right-hand side accounts for the nonlinear effects of population dynamics, and is the fundamental difference from the size-structured community model (Hartvig, Andersen & Beyer, 2011) and physiologically structured population model (De Roos et al., 2008;Metz & Diekmann, 1986), in which nonlinearity appears in the term g(s) where, for instance, predation effects are incorporated (i.e., these are quasilinear equations). Note that Eq.
(1) has the same form as the aforementioned models, except for the explicit nonlinearity, and it can be reduced to these models by removing the nonlinear term and defining g(s) accordingly. Equation (1) is complemented with the boundary conditions where b i (s) is the birth rate of species i in state s andb i s ð Þj s 0 ð Þ is the birth rate of species i in state s as the result of predation on species j in state s′. Note that a cannibalistic interaction can be considered by settingb i s ð Þi s 0 ð Þ . 0. These values are described as where the notation i(s) indicates species i in state s. To describe the two-species role-level dynamics in the main text, the number of species is fixed to two, denoted as n x and n y , respectively, instead of n i . This is an N-species generalization of the nonlinear size-structured model discussed in Hastings (1987) and Nisbet & Gurney (1982).

Role-level dynamics
The state-level model can be scaled-up to describe the dynamics of different roles in each species, and a variable corresponding to each role can be used to obtain the role-level dynamics. I assume that state development over time causes the ontogenetic diet/trophic niche shift in a well-mixed region; i.e., role shift. Here, I am interested in the general effect of this role shift on the population dynamics. For this purpose, I discuss the simplest possible situation, in which the rate of state growth is a constant g(s) = 1, the number of species is two (represented by x and y), and the number of roles is two, and only species y changes its role. y 1 and y 2 are non-overlapping role groups in population y, and y 1 is assumed to be earlier stage than y 2 , where the role shift occurs in state s 1 . Integrating n x and n y accordingly, these are described as Hence, by integrating over state s in Eq.
(1), the role-level model becomes (see Section "Derivation of the role-level dynamics"): where r X is the growth rate of X 2 x; y 1 ; y 2 f g, which can be either a species or a role (simply referred to as "type" hereafter). r X can further be decomposed into b X À d X , where b X and d X are the birth rate and death rate of type X , respectively. a XX 0 represents the interaction strength between type X and X 0 2 x; y 1 ; y 2 f g; a positive sign indicates that type X 0 has a positive influence on the population of type X , and vice versa. P X represents the sum over the variables. m is the transition rate from type y 1 to y 2 . I A is an indicator variable that is equal to 1 if y 2 is a predator and equal to 0 otherwise. Equation (5) has a similar form to the Lotka-Volterra-type model, but a major difference is that the birth event of role y 2 increases the population number of role y 1 , and the transition rate m mediates the effect of the role shift.
The generalization of the role-level model is straightforward, and Section "Generalizations of the role-level model" describes generalized role-level models in which (i) species y has n roles; (ii) species x and y have n′ and n roles, respectively; and (iii) N species have (n 1 , … , n N ) roles (n i is the number of roles of species i). Via Eq. (5), various role-shift scenarios can be described: (i) from inferior/superior competitor to superior/ inferior competitor; (ii) from competitor to predator; and (iii) from prey to predator. The specific forms of these models are provided in Section "Specific form of the role-level model".

Population-level dynamics
By further scaling-up the focal level of the population dynamics, the role-level model can be converted into the population-level model. This process aggregates the two roles y 1 and y 2 into a single variable. I introduce a new variable y(t) = y 1 (t) + y 2 (t), and let y 1 (t) = (1 − a(t)) y(t) and y 2 (t) = a(t) y(t), where a(t) 2 [0,1] is the proportion of y 2 in species y at time t (i.e., a(t) = y 2 (t)/(y 1 (t) + y 2 (t))). By summing Eqs. (5b) and (5c), Eq. (5) becomes where Eq. (6) has the form of the Lotka-Volterra model, but the parameters r y , a x y , a yx , and a y are time-dependent because the role-level information is carried over. Therefore, Eq. (6) contains larger information than the usual Lotka-Volterra model. These parameters are described as Values of a = 0 or 1 correspond to the usual (unstructured) Lotka-Volterra model, giving constant interaction coefficients. This Lotka-Volterra model can also be derived directly from Eq. (1) by scaling-up to a population level with a constant interaction strength (a xy , a yx ). The magnitude of a is mediated by the transition rate m: a larger value of a is realized with a larger transition rate m, and vice versa. Note that each parameter in the role-shift model appears in the parameters in Eq. (7), and these mediate the effects of roles in the population-level model. While these coefficients change dynamically over time, a(t) converges to an equilibrium a Ã = y Ã 2 /(y Ã 1 + y Ã 2 ) if there is no periodic solution in the role-level dynamics. Hence, if there is a unique and stable nontrivial equilibrium, the stability of the equilibrium can be discussed via the ordinary analytical tools of the Lotka-Volterra model, such as isoclines. If there is a periodic solution such as the limit cycle or chaos, a(t) does not converge and this approach fails.
There is ample literature about the stability issue of dynamical systems (e.g., Hirsch, Smale & Devaney, 2012;Strogatz, 2014), including the one in the Lotka-Volterra model (e.g., Hofbauer & Sigmund, 1998;Kot, 2001;Murray, 2004) where various methods for evaluating the stability of equilibrium can be found. Similarly, if the concerned system exhibits bistability, a(t) does not converge to a unique value, and again, the equilibrium analysis via the population-level model fails: the investigation of the role-level dynamics is necessary. Following analysis and numerical simulations suggest that the concerned role-level and population-level dynamics do not have a periodic solution, but these can exhibit bistability. To summarize the discussions above, Fig. 2 shows examples of the relationship between equilibrium value of a and m. Both panels show the increasing trends of a Ã as the transition rate m increases. Fig. 2B demonstrates the existence of bistability, and the presented equilibrium analysis cannot apply to this region.

Effect of role shift on interaction strength of population-level dynamics
As stated in the previous section, the parameters in the role-level model appear in the parameters of the population-level model (Eq. (7)). Hence, it is important to ask how the role shift affects the interaction strength between species (a x y ; a yx ) in the population-level model. From Eq. (7), it is apparent that a x y and a yx are monotonic increasing or decreasing functions of the proportional parameter a, depending on the signs of a xy 2 À a xy 1 and a y 2 x À a y 1 x . Figure 3 shows schematic examples of the interaction coefficients in the population-level model as a function of the proportional parameter a. When the two roles are both competitors (i.e., inferior and superior competitors; Fig. 3A), the interaction coefficients (a x y ; a yx ) have the signs (−, −). Namely, the population-level model exhibits the features of the competition model. When the role shift is from competitor to predator (Fig. 3B), the signs of the interaction coefficients are either (−, −) or (−, +). The largest number of combinations is realized when the role shift is from prey to predator (Fig. 3C), which could produce the combinations (−, −), (−, +), (+, −), or (+, +),

Coexistence and bistability of role-level and population-level dynamics
Using the interaction coefficients in the population-level model, I now investigate the roleand population-level dynamics. In two-species population models, analysis via isoclines provides an outline of the dynamics (Murray, 2004). However, in the population-level model, the parameters in Eq. (7) vary with time, and ordinary isocline analysis is not directly applicable. Instead, I focus on the equilibrium properties of the dynamics, which can be determined by the configuration of isoclines in equilibrium. The equilibrium isoclines of the population-level model (Eq. (6)) are given by where Ã denotes equilibrium. Using these isoclines, it is straightforward to obtain the coexistence condition of the population-level dynamics (see Fig. A.1). For example, when the role shift is from inferior competitor to superior competitor and the interaction coefficients are a x y t ð Þ , 0 and a yx t ð Þ , 0, the coexistence condition is a Ã yx =a x , r Ã y =r x , a Ã y =a Ã x y . The full list can be found in Table A.1 and these are numerically verified. Examples of population-level dynamics and the corresponding role-level dynamics are presented in Fig. 4 for the case in which two species coexist. The parameter values used in the role-level dynamics are listed in Table A.2. These numerical calculations  Table A.2. The parameter values of the population-level dynamics can be readily obtained from Eq. (7) and the equilibrium proportion of y 2 a Ã , in the corresponding role-level dynamics.
Full-size  DOI: 10.7717/peerj.13315/ fig-4 confirm that the role-and population-level dynamics are consistent in terms of the equilibrium values of two species. Considering the possible signs of the interaction coefficients in the population-level model (Fig. 3), bistability can occur in all role-shift scenarios. In this case, analysis via the equilibrium isoclines immediately provides the necessary conditions. The conditions for bistability are listed in Table A.3. Figure 5 shows the role-level and population-level dynamics under bistability conditions. The parameter values used in the role-level dynamics are listed in Table A There is clearly an agreement between the role-and population-level dynamics at equilibrium. The equilibrium isoclines of the population-level model is shown in Fig. A.2. As expected, the aggregation of roles into the population-level dynamics does not always work under bistability conditions, because the values of the proportional parameter a differ in the two stable states. When the mismatch of equilibrium values between the role-and population-level dynamics is minor in simulations with randomly generated parameter values (ca. 0.24% over 10 5 random parameter sets; see Section "Mathematical discussion of the role-level model" for more details), it is safe to analyze the role-level dynamics instead of the corresponding population-level effects.

DISCUSSION
Intraspecific state variations (e.g., age, weight) and multiple roles in species interactions (e.g., competitor and predator) within a population are ubiquitous (Winemiller, 1989;Yang & Rudolf, 2010). However, describing all these details comes at a significant cost of increased model complexity and analytical intractability. Thus, multiple methods of describing the ecological community are beneficial that allows us to simplify the discussion of ecological dynamics via a simpler description. Starting from the N-species dynamics in which each species has continuously varying states (Eq. (1)), the role-level (Eq. (5)) and population-level dynamics (Eq. (6)) are obtained by scaling-up to the focal level of description of the ecological community. In this sense, the role-and population-level models are not given models but derived from the more detailed state-level model. The population-level description corresponds to the Lotka-Volterra-type dynamics. We demonstrated that, even when a species has multiple interaction strengths in the interaction with another species, the equilibrium state can still be predicted by the Lotka-Volterra model. As the Lotka-Volterra dynamics have a nonlinear term, nonlinearity is also necessary in the state-level description to establish the connections. This approach is essentially an N-species generalization of the nonlinear size-structured model (e.g., Hastings, 1987;Nisbet & Gurney, 1982), but no explicit multi-species generalization or derivation of an intermediate-level description (i.e., role-level description) has previously, to the best of the author's knowledge, been carried out.
I have demonstrated that an intermediate description is determined by the role between the interaction with another species, although alternative choices are also possible. For example, Hastings (1987) studied cannibalistic interactions between the eggs and larvae of Tribolium, and these life stages provide a better choice for the intermediate description. It is also reasonable to choose life stages for fish species and, in fact, state-level, life stage-level, and population-level discussions can be independently used (e.g., Clark, 2010;Micheli et al., 2004;Plank, 2017). These choices should be made based on the ecological question being considered.
The simplest situation was examined as a means of establishing the links between multi-level population dynamics in which species y has two roles, but it is easy to extend this situation. For example, the number of species and roles are arbitrary (Section "Generalizations of the role-level model"), and a nonlinear predation rate, such as Holling's type II functional response (Murray, 2004), is straightforward to incorporate. Additionally, more complex models (De Roos, 1997;Hartvig, Andersen & Beyer, 2011) can incorporate growth on the state axis as the result of energy intake. As these models are described in the form of the McKendrick-von Foerster equation (Eq. (1), but without the nonlinear term), most such elaborations can be incorporated into the proposed model.
By taking advantage of the consistent link to the Lotka-Volterra model, I next demonstrated a potential simplification for the stability analysis of the role-level model using a population-level (i.e., Lotka-Volterra model) discussion in the case of a unique and stable nontrivial equilibrium. This offers new insights into species interaction and stability where a species has multiple interaction strengths in the interaction with another species. For the coexistence of two species where one species has two roles (e.g., prey and predator), the signs of the interaction coefficients and the number of plausible combinations of signs in the population-level dynamics (Eq. (6)) differ between role-shift scenarios. For example, with a role-shift scenario from an inferior to superior competitor, the only plausible signs of the interaction coefficients are (−, −). In contrast, the combinations (−, −), (−, +), (+, −), (+, +) are possible with the role-shift scenario from prey to predator (Table A.1). Thus, the model is capable of handling more diverse species interaction strengths. The transition rate m mediates the effect of the role shift caused by an ontogenetic diet/trophic niche shift, and influences the interaction coefficients in the population-level description (Eq. (7)). A role shift influences the magnitude of the interaction strength arbitrarily and, therefore, the coexistence condition at the populationlevel. However, as in the role-shift scenario from prey to predator, more diverse coexistence scenarios than the classical Lotka-Volterra-type competition and prey-predator dynamics are possible. Wollrab, de Roos & Diehl (2013) demonstrated that an ontogenetic diet shift enhances the chance of predator-mediated coexistence in competing prey species. The timing of the ontogenetic shift can be adaptive, leading to stabilized consumer-resource dynamics (Takimoto, 2003). Bistability or alternative stable states are possible in the Lotka-Volterra competition model (Murray, 2004); this is often referred to as the priority effect (Ke & Letten, 2018), where historical contingency affects the assembly and function of ecological communities (Chase, 2003;Fukami, 2015). I have shown that the role-level dynamics can also induce bistability under all role-shift scenarios discussed, suggesting that the priority effect can prevail in nature in the presence of various species interactions.
The coexistence and bistability conditions at the population-level discussion are provided in Tables A.3 and A.4. The dynamics at the role and population levels for each case are displayed in Figs. 4 and 5. This suggests that the parameters in the role-level model map onto a sufficiently large parameter space of the population-level model at equilibrium. That is, given a set of parameters in the population-level model, one is likely to find parameter sets in the role-level model that again correspond to the initial parameters via the relationship of Eq. (7). This property simplifies the discussion: one can start with a (simpler) population-level discussion, and later find a connection to the (more complex) role-level discussion; this is how the parameter sets used in Fig. 5 were identified. A detailed mathematical discussion will facilitate this aspect.
Climatic change affects ontogeny and phenology, and alters species interactions (Thackeray, Jones & Maberly, 2008;Yang & Rudolf, 2010). A general insight into the climatic effects on interspecific interactions is essential, and is one possible application of show the situation in which species y becomes extinct (with the initial condition x ¼ 100; y 1 ¼ y 2 ¼ 0:05) and the bottom (A′-C′) show that species x becomes extinct (with the initial condition x ¼ 0:1; y 1 ¼ y 2 ¼ 50). I set a ¼ 0 if y 1 þ y 2 < 10 À4 . Inset figures in (A) show dynamics of species y and a near the initial states. The parameter values used in the role-level dynamics are listed in Table A.4. For the population-level dynamics, the parameter values are readily obtained from Eq. (7) and the equilibrium proportion of y 2 , a Ã , in the corresponding role-level dynamics.
Full-size  DOI: 10.7717/peerj.13315/ fig-5 the model. In the context of such models, climate change leads to an altered proportional parameter (i.e., the proportion of y 2 ) a in the population-level model (or a different rate of growth of g(s) in Eq. (1) or transition rate m in Eq. (5)). This will cause a shift in the values of the coefficient parameters, or may even change their signs (Fig. 3). For example, assume that the role-shift scenario is from inferior to superior competitor (Fig. 3A: top), and climate change increases the rate of growth of species y, causing a larger transition rate m to an alternative role and a larger value of a. These effects will increase a x y and decrease a yx , respectively (Fig. 3A: top). Using Fig. 3, it is possible to predict potential sign shifts in the interaction coefficients induced by climatic changes. For example, in the role-shift scenario from prey to predator (Fig. 3C), À; þ ð Þ$ þ; þ ð Þ$ þ; À ð Þ and À; þ ð Þ$ À; À ð Þ$ þ; À ð Þ are possible, whereas the shift between (+, +) and (−, −) cannot occur.
In this article, I have demonstrated the explicit links between different descriptions of an ecological community (state-, role-, or population-level). The model complexity is controlled by scaling-up the focal level of the description. This offers the opportunity to attack ecological questions using various models that describe the same phenomena, but at different scales.

Derivation of the role-level dynamics
The population dynamics of species i in state s (e.g., size, age), n i (s,t), are described by Eq. (1) in the main text. 1 The connection to the role-level dynamics (and consequently the population-level dynamics) is demonstrated by considering the simplest possible situation with a constant rate of state growth g(s) = 1. Let the number of species be fixed to two, denoted by n x and n y , respectively, instead of n i . Furthermore, assume that species y has a role-shift property and each role is described by y 1 and y 2 , where the role shift occurs in state s 1 . Hence, the population size of these roles are described by x ¼ R 1 0 n x s; t ð Þds; y 1 ¼ R s 1 0 n y s; t ð Þds, and y 2 ¼ R 1 s 1 n y s; t ð Þds. Now, the interaction coefficients depend on the species or role (type, hereafter) X 2 x; y 1 ; y 2 f g, rather than the state. Hence, the subscripts of interaction strength a i(s)j(s′) in Eq. (1) are replaced with the label of the role.
Integrating both sides of Eq. (1) over all possible s 2 [0,∞) yields dy 1 dt ¼ n y 0 ð Þ À n y s 1 ð Þ À d y 1 y 1 À y 1 X X2 x;y 1 ;y 2 f g a y 1 X X ; (A.1b) dy 2 dt ¼ n y s 1 ð Þ À d y 2 y 2 À a y 1 y 2 1 À y 2 X X2 x;y 1 ;y 2 f g a y 2 X X ; (A.1c) 1 The generalization to a multiple-state model may be obtained by replacing s with s in Eq.
(1), where s ¼ ðs 1 ; s 2 ; . . . ; s n Þ 2 S is a state vector corresponding to a set of states in the ndimensional state space. Provided that s 1 , . . . , s n are orthogonal, the second term on the left-hand side of Eq. (A.1) is described by the gradient operator.
where n x (0) and n y (0) represent the recruitment of species x and y, respectively, and P X represents the sum over variables X 2 x; y 1 ; y 2 f g. As an example, n x (0) is obtained from the integration of the second term on the left-hand side in Eq. (1) with i = x: Under the assumption of homogeneity within a role (i.e., all individuals with a certain role are identical), n x (0) = b x x ( = ∫ b x n x (s,t) ds) and n y (0) = b y1 y 1 + b y2 y 2 + I A a y2x xy 2 , where b X is the birth rate of type X and a y2x is the reproductive term under the predation of species x by type y 2 . Additionally, I A is an indicator variable with a value of 1 if y 2 is a predator role and a value of 0 otherwise. n y (s 1 ) represents a shift from type y 1 to type y 2 . This can be described as my 1 , where m is the transition rate. By summarizing these discussions, and noting that the net growth rate is described by r X ¼ b X À d X , Eq. (A.1) corresponds to role-level dynamics defined in Eq. (5) in the main text. I define the coefficient matrix of Eq. (5) as   (6)).
Signs of (a x y ; a yx ) Coexistence condition Competitor ( where a XX is denoted as a X for brevity. The signs of the components of the coefficient matrices for the three situations of (i) inferior competitor to superior competitor, (ii) competitor to predator, and (iii) prey to predator become i ð Þ À À À À À À À À À

Generalizations of the role-level model
Two-species n-role model It is straightforward to extend the two-role assumption by following the similar step presented in Section "Derivation of the role-level dynamics". Assume that the number of roles of species y is n, and represent these roles by y = (y 1 , … , y n ). The order of the elements of the vector corresponds to the order of occurrence of each role in the species' life history; hence, the state of species y at birth is y 1 . All roles contributing to the growth of species y appear in the dynamics of y 1 , and the transition rate m connects each role. The two-species role-level dynamics become x;yny n f g a y n Z Z þ 1 À I y n À Á a y n x x 0 @ 1 A þ my nÀ1 ; where y\y i = (y 1 , … , y i − 1 , y i + 1 , … ,y n ). Equation (A.4) again recovers the Lotka-Volterra equation, as in the main text: dx dt ¼ x r x þ a x x þ a x y t ð Þ y À Á ; d y dt ¼ y r y t ð Þ þ a y t ð Þ y þ a yx t ð Þx À Á ; (A.5) where r y , a x y , a yx , and a y differ from Eq. (7) in the main text. In the n-role case, these parameters are described as follows: where a Y is the fraction of role Y 2 {y 1 , … , y n }, which satisfies ay 1 + Á Á Á + ay n = 1. a YY′ is the intraspecific interaction of the heterogeneous types Y,Y′ 2 {y 1 , … , y n }. Hence, the where in which X i 2 x i1 ; Á Á Á ; x in 1 f g , X 2 x 11 ; Á Á Á ; x 1n 1 ; Á Á Á x N1 ; Á Á Á ; x Nn N f g , and XnX i 2 x 11 ; Á Á Á ; x 1n 1 ; Á Á Á x iÀ1;1 ; Á Á Á ; x iÀ1;n iÀ1 ; x iþ1;1 ; Á Á Á ; x iþ1;n iþ1 ; Á Á Á x N1 ; Á Á Á ; x Nn N È É .

Specific form of the role-level model
From inferior competitor to superior competitor From Eq. (5), the models under different role-shift scenarios can be derived. When the role-shift is from inferior competitor to superior competitor, dx dt ¼ x r x þ a x x þ a xy 1 y 1 þ a xy 2 y 2 À Á ; dy 1 dt ¼ y 1 r y 1 þ a y 1 y 1 þ a y 1 y 2 y 2 þ a y 1 x x À Á þ b y 2 y 2 À my 1 ; dy 2 dt ¼ y 2 Àd y 2 þ a y 2 x x þ a y 2 y 1 y 1 þ a y 2 y 2 À Á þ my 1 ; (A.11) where, by definition, ja xy 1 j , ja y 1 x jand ja xy 2 j . ja y 2 x j are satisfied. From competitor to predator dx dt ¼ x r x þ a x x þ a xy 1 y 1 þ a xy 2 y 2 À Á ; dy 1 dt ¼ y 1 Àd y 1 þ a y 1 y 1 þ a y 1 y 2 y 2 þ a y 1 x x À Á þ a y 2 x xy 2 À my 1 ; dy 2 dt ¼ y 2 Àd y 2 þ a y 2 y 1 y 1 þ a y 2 y 2 À Á þ my 1 : (A.12) I assume that species y is a specialist predator, and the population growth comes from the predation of species x.
From prey to predator dx dt ¼ x Àd x þ a x x þ a xy 1 y 1 þ a xy 2 y 2 À Á ; dy 1 dt ¼ y 1 Àd y 1 þ a y 1 y 1 þ a y 1 y 2 y 2 þ a y 1 x x À Á þ a y 2 x xy 2 À my 1 ; dy 2 dt ¼ y 2 Àd y 2 þ a y 2 y 1 y 1 þ a y 2 y 2 À Á þ my 1 ; (A.13) where species x is simultaneously the predator of y 1 and the prey of y 2 . Additionally, species x is a specialist predator, and so population growth occurs by consuming y 1 . The growth rate of species X is denoted by r X = − d X .

Numerical error search
In the population-level dynamics (Eq. (6)) in the main text, the isolines at equilibrium are not unique for cases of bistability. This is the source of the mismatch in equilibrium values between the role-level and population-level dynamics. To check the match between the two models, 10 5 parameter sets were randomly generated and the equilibrium values of the role-level and population-level dynamics were checked for each of the parameters. I counted a parameter set as mismatch if the equilibrium values satisfied with jx Ã À x Ã pop j þ jy Ã 1 þ y Ã 2 À y Ã j . 10 À3 where x Ã pop is the equilibrium of species x in the population-level model. Each parameter sets were examined with two initial conditions to check bistability. The parameter sets were generated in the following manner: b Z $ U 0; 1 ½ ; d Z $ U 0; 0:5 ½ ; a Z $ U À1; 0 ½ ; ja ZZ j $ U 0; 1 ½ ; m $ U 0; 20 ½ ; (B.1) where Z = {x,y 1 ,y 2 }, a ZZ represents all possible heterogeneous pairs of {x,y 1 ,y 2 }, and U[a,b] is a uniform distribution over the range [a,b]. The role-shift scenario was chosen at random, and the signs of a ZZ were chosen accordingly. I found 238 parameter sets (ca. 0.24%) that caused inconsistent equilibrium values. All these cases led to a bistability condition in the population-level model, but the role-level dynamics instead converged to a stable equilibrium for cases (i), (ii), and (iii.a), or to one of the equilibria regardless of stability for case (iii.b) in Table A.4.